<!--
This source file is part of the Swift.org open source project

Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
-->

<script src="https://swift.org/assets/javascripts/docc/footer.js"></script>
<footer id="footer" role="contentinfo" hidden>
  <div class="container">
    <div>
      <p class="copyright">Copyright © 2014–2025 Apple Inc. and the Swift project authors. All rights reserved.</p>
      <p>This document is made available under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/" style="color: #09f">Creative Commons Attribution 4.0 International (CC BY 4.0) License</a>.</p>
      <p class="trademark">Swift and the Swift logo are trademarks of Apple Inc.</p>
      <p class="privacy">
        <a href="//www.apple.com/privacy/privacy-policy/">Privacy Policy</a>
        <a href="//www.apple.com/legal/privacy/en-ww/cookies/">Cookies</a>
      </p>
    </div>
    <div class="footer-other">
      <form
        class="color-scheme-toggle"
        role="radiogroup"
        tabindex="0"
        id="color-scheme-toggle"
      >
        <legend class="visuallyhidden">Color scheme preference</legend>
        <label for="scheme-light">
          <input id="scheme-light" type="radio" class="visuallyhidden" name="color-scheme-preference" value="light" onchange="doccAppearance('light')">
          <span class="color-scheme-toggle-label">Light</span>
        </label>
        <label for="scheme-dark">
          <input id="scheme-dark" type="radio" class="visuallyhidden" name="color-scheme-preference" value="dark" onchange="doccAppearance('dark')">
          <span class="color-scheme-toggle-label">Dark</span>
        </label>
        <label for="scheme-auto" id="scheme-auto-wrapper">
          <input id="scheme-auto" type="radio" class="visuallyhidden" name="color-scheme-preference" value="auto" onchange="doccAppearance('auto')">
          <span class="color-scheme-toggle-label">Auto</span>
        </label>
      </form>
      <aside>
      <a href="/atom.xml" title="Subscribe to Site Updates"><i class="feed"></i></a>
      <a href="https://twitter.com/swiftlang" rel="nofollow" title="Follow @SwiftLang on Twitter"><i class="twitter"></i></a>
    </aside>
    </div>
  </div>
  <style type="text/css">
    /*
    Expanded SCSS from apple/swift-org-website commit a09c14493f812:
    /assets/stylesheets/_screen.scss#L925
    */
    .color-scheme-toggle {
        display: block;
        outline: none;
        --toggle-color-fill: var(--color-button-background);
        font-size: 12px;
        border: 1px solid #fff;
        border-radius: 4px;
        display: inline-flex;
        padding: 1px;
        margin-bottom: 1em;
    }

    .color-scheme-toggle input {
        position: absolute;
        clip: rect(1px, 1px, 1px, 1px);
        clip-path: inset(0px 0px 99.9% 99.9%);
        overflow: hidden;
        height: 1px;
        width: 1px;
        padding: 0;
        border: 0;
        appearance:none
    }

    .color-scheme-toggle-label {
        border: 1px solid transparent;
        border-radius: var(--toggle-border-radius-inner, 2px);
        display: inline-block;
        text-align: center;
        padding: 1px 6px;
        min-width: 42px;
        box-sizing:border-box
    }

    .color-scheme-toggle-label:hover {
        cursor:pointer
    }

    input:checked + .color-scheme-toggle-label {
        background: #fff;
        color: rgba(42,42,42,0.9);
    }

    [role="contentinfo"] {
        display: flex;
        justify-content:space-between
    }

    .visuallyhidden {
        position: absolute;
        clip: rect(1px, 1px, 1px, 1px);
        clip-path: inset(0px 0px 99.9% 99.9%);
        overflow: hidden;
        height: 1px;
        width: 1px;
        padding: 0;
        border:0
    }
  </style>
  <script type="text/javascript">
    // DocC uses this local storage key to persist appearance preferences.
    const appearanceKey = 'developer.setting.preferredColorScheme'
    window.addEventListener('DOMContentLoaded', _ => {
      let appearancePreference = localStorage.getItem(appearanceKey)
      if (appearancePreference) {
        // Set a color scheme according to a saved preference.
        document.body.dataset.colorScheme = appearancePreference
        document.querySelector('custom-footer')
          .shadowRoot
          .querySelector(`#scheme-${appearancePreference}`)
          .checked = true
      } else {
        document.querySelector('custom-footer')
          .shadowRoot
          .querySelector(`#scheme-auto`)
          .checked = true
      }
    })

    // Set a color scheme based on user choice and persist it.
    function doccAppearance(mode) {
      document.body.dataset.colorScheme = mode
      switch(mode) {
      case 'light':
        localStorage.setItem(appearanceKey, mode)
        break
      case 'dark':
        localStorage.setItem(appearanceKey, mode)
        break
      case 'auto':
        localStorage.removeItem(appearanceKey)
        break
      }
    }
  </script>
</footer>
